<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title></title>
</head>
<body>

<input type="text" name="" id="name" value="" /><br/>
<span id="text"></span>
<script>
    window.onload = function(){
        var name = document.getElementById('name');
        var text = document.getElementById('text');
        regName = /^[\u4e00-\u9fa5]{2,6}$/;
        name.onblur = function(){
            var nameValue = name.value; //console.log( regName.test(nameValue) );
            if ( regName.test(nameValue) ){
                text.innerText='正确';
                console.log( '正确' );
            }else{
                text.innerText='错误';
                console.log( '错误' );

            }
        }
    };
</script>


</body>
</html>